package com.heng.test.CG;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import java.lang.reflect.Method;

public class KafkaServiceInterceptor implements MethodInterceptor {

    @Override
    public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
        System.out.println("Before producing...");
        
        // 执行父类(即原始KafkaService类)的方法
        Object result = proxy.invokeSuper(obj, args); 

        System.out.println("After producing...");
        return result;
    }
}